Do not embed any timestamp in the built documentation.

Upstream issue: https://github.com/robotframework/robotframework/issues/4262.

diff --git a/doc/userguide/ug2html.py b/doc/userguide/ug2html.py
index 43cdb31bd..550e74a79 100755
--- a/doc/userguide/ug2html.py
+++ b/doc/userguide/ug2html.py
@@ -158,8 +158,7 @@ def create_userguide():
     install_file = _copy_installation_instructions()
 
     description = 'HTML generator for Robot Framework User Guide.'
-    arguments = ['--time',
-                 '--stylesheet-path', ['src/userguide.css'],
+    arguments = ['--stylesheet-path', ['src/userguide.css'],
                  'src/RobotFrameworkUserGuide.rst',
                  'RobotFrameworkUserGuide.html']
     os.chdir(CURDIR)
diff --git a/src/robot/libdocpkg/model.py b/src/robot/libdocpkg/model.py
index 4d9ffd70b..5c276d1d6 100644
--- a/src/robot/libdocpkg/model.py
+++ b/src/robot/libdocpkg/model.py
@@ -14,6 +14,7 @@
 #  limitations under the License.
 
 import json
+import os
 import re
 from itertools import chain
 
@@ -113,7 +114,8 @@ class LibraryDoc(object):
             'name': self.name,
             'doc': self.doc,
             'version': self.version,
-            'generated': get_timestamp(daysep='-', millissep=None),
+            'generated': ('' if os.environ['SOURCE_DATE_EPOCH']
+                          else get_timestamp(daysep='-', millissep=None)),
             'type': self.type,
             'scope': self.scope,
             'docFormat': self.doc_format,
diff --git a/src/robot/libdocpkg/xmlwriter.py b/src/robot/libdocpkg/xmlwriter.py
index 3882e1219..4a84fb42e 100644
--- a/src/robot/libdocpkg/xmlwriter.py
+++ b/src/robot/libdocpkg/xmlwriter.py
@@ -14,6 +14,8 @@
 #  limitations under the License.
 
 import os.path
+import os
+
 from datetime import datetime
 
 from robot.utils import WINDOWS, XmlWriter, unicode
@@ -30,7 +32,9 @@ class LibdocXmlWriter(object):
         self._write_end(writer)
 
     def _write_start(self, libdoc, writer):
-        generated = datetime.utcnow().replace(microsecond=0).isoformat() + 'Z'
+        generated = (
+            '' if os.environ['SOURCE_DATE_EPOCH']
+            else datetime.utcnow().replace(microsecond=0).isoformat() + 'Z')
         attrs = {'name': libdoc.name,
                  'type': libdoc.type,
                  'format': libdoc.doc_format,
